import * as YvanUI from 'yvan-ui-wotu'
import CustomData from "../widget/custom.data";

const _ = YvanUI.lodash
const React = YvanUI.React

interface Ref {

}

export default class Layout2 extends YvanUI.Scope<void, Ref> {

    main = this.$$({})

    vjson = {
        title: '布局4',
        items: [
            {
                view: 'card',
                style: {
                    marginBottom: '12px'
                },
                bodyStyle: {
                    padding: '20px 20px 0 20px'
                },
                items: [
                    {
                        view: 'form-plus',
                        defaultExpand: true,
                        items: [
                            {view: 'text', label: 'text1', bind: 'main.form.f1'},
                            {view: 'text', label: 'text2', bind: 'main.form.f2'},
                            {view: 'text', label: 'text3', bind: 'main.form.f3', isExtend: true},
                            {view: 'text', label: 'text4', bind: 'main.form.f4', isExtend: true},
                            {view: 'text', label: 'text5', bind: 'main.form.f5', isExtend: true},
                            {view: 'text', label: 'text6', bind: 'main.form.f6', isExtend: true},
                            {view: 'text', label: 'text6', bind: 'main.form.f7', isExtend: true},
                        ],
                        onResetClick: (sender: YvanUI.FormPlus, theform: YvanUI.Form) => {
                            theform.resetFields()
                        },
                        onSubmitClick: (sender: YvanUI.FormPlus, theform: YvanUI.Form) => new Promise((resolve, reject) => {
                            theform.validateFields().then(() => {
                                setTimeout(() => {
                                    resolve('ok')
                                }, 3000)

                            }).catch(e => {
                                YvanUI.showValidateErrorDialog(this, e)
                                reject(e)
                            })
                        })
                    }
                ]
            },
            {
                view: 'card',
                items: [
                    {
                        view: 'spliter',
                        defaultSize: '50%',
                        items: [
                            {
                                view: 'grid',
                            },
                            {
                                view: 'grid'
                            }
                        ]
                    }
                ]
            }
        ]
    }

}